package test.datafile3;

import java.io.File;

import junit.framework.TestCase;

import com.amtf.datafile3.DataException;
import com.amtf.datafile3.DefinitionException;
import com.amtf.utils.RecordsPrinter;

public abstract class BasicTestCase extends TestCase {
	protected static String basicDir = "D:\\WORKSPACE3.7\\AMTF_Datafile\\Test_Data\\";
	protected static File txtNoData = new File(basicDir + "blank.csv");
	protected static File txtNotExists = new File(basicDir + "txtNotExists.csv");
	protected long t1;
	protected int rowcnt = 1;
	protected RecordsPrinter printer = new RecordsPrinter();

	public abstract void test_okcase_PrintAllInFile() throws DataException;

	public abstract void test_okcase_PrintAllInFile_ByXmlDef() throws DataException, DefinitionException;

	public abstract void test_okcase_PrintInvalid_ByXmlDef() throws DataException, DefinitionException;

	public abstract void test_okcase_SpeedOfReadBigData() throws DataException, DefinitionException;

	public abstract void test_okcase_PrintReadStartFromRow30_Notitle() throws DataException;

	public abstract void test_okcase_ReadBlankFile() throws DataException;

	public abstract void test_okcase_ReadNotExistsFile() throws DataException;

	public abstract void test_okcase_PrintTop10OfTableDataInCatalog() throws DefinitionException, DataException;

	public abstract void test_okcase_WriteFormCurrentFileType2Xsv() throws DataException, DefinitionException;

	public abstract void test_okcase_WriteFormCurrentFileTypeWithDefaultDef2Xsv_ByWriteAllFunction() throws DataException, DefinitionException;

	public abstract void test_okcase_WriteFormCurrentFileTypeWithXmlDef2Xsv_ByWriteAllFunction() throws DataException, DefinitionException;

	public abstract void test_okcase_WriteFormXmlDefXsv2CurrentFileType_ByWriteAllFunction() throws DataException, DefinitionException;

	public abstract void test_okcase_ModifyAndWriteToNewTabe() throws DataException, DefinitionException;

	public abstract void test_okcase_PrintReadFirstRowTwice() throws DataException;

	@Override
	protected void setUp() throws Exception {
		rowcnt = 1;
		t1 = System.currentTimeMillis();
	}

	@Override
	protected void tearDown() throws Exception {
		printer.printout();

		System.out.println("Totle row=" + rowcnt);

		long t2 = System.currentTimeMillis();
		long usetm = t2 - t1;
		System.out.println("TimeMillis=" + (usetm < 31 ? usetm : usetm - 31));
	}
	
	protected static File newFile(String name) {
		return new File(basicDir+name);
	}

}
